package com.atxyj.proxy.statics;

/**
 * @author xieyujiao
 * @description
 * @date 2021/9/3
 */
public class TestStaticProxy {

    public static void main(String[] args) {
        useStatic();
    }

    public static void noStatic() {
        //不使用静态代理
        UserServiceImpl userService = new UserServiceImpl();
        //执行业务层
        userService.getName();
    }

    public static void useStatic() {
        UserServiceImpl userService = new UserServiceImpl();
        //将被代理对象传入代理对象中，调用被代理对象方法
        UserServiceProxy userServiceProxy = new UserServiceProxy(userService);
        userServiceProxy.getName();
    }
}
